package com.AFH.test;

import java.util.Date;

public class UserProfile {
	int Money;
	int BombNumber;
	Date gameStartTime;
	Date gameEndTime;
	int monsterMissed;
	int monsterPermitted;
	int score;

	public UserProfile(int monsterPermitted) {
		Money = 400;
		BombNumber = 0;
		monsterMissed = 0;
		this.monsterPermitted = monsterPermitted;
		gameStartTime = new Date(System.currentTimeMillis());
		score=0;

	}

	public boolean lostGame() {
		if (monsterMissed > monsterPermitted) {
			endGame();
			return true;
		} else
			return false;
	}

	public void endGame() {
		if(gameEndTime==null) gameEndTime = new Date(System.currentTimeMillis());
	}

	public String timeUsed(){
		long between=(gameEndTime.getTime()-gameStartTime.getTime())/1000;//除以1000是为了转换成秒   
		long day=between/(24*3600); 
		long hour=between%(24*3600)/3600;   
		long minute=between%3600/60;   
		long second=between%60; 
		String timeUsed="Time: "+day+"days "+hour+":"+minute+":"+second;
		return timeUsed;
	}
}
